package schedule;


import java.util.Collection;


public class UpdateEvent implements Command
{
	private Event oldEvent;
	private Event newEvent;
	
	public UpdateEvent(Event oldEvent, Event newEvent)
	{
		this.oldEvent = oldEvent;
		this.newEvent = newEvent;
	}

	@Override
	public void execute(Collection<Event> events) 
	{
		events.remove(oldEvent);
		events.add(newEvent);
	}

	@Override
	public void unexecute(Collection<Event> events) 
	{
		events.remove(newEvent);
		events.add(oldEvent);
	}
}
